<?php

Yii::import('application.models._base.BaseProfiles');

class Profiles extends BaseProfiles
{
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
         public function rules() {
        $arr = array(
            array('firstname,lastname', 'required'),
            array('users_id, timestamp', 'numerical', 'integerOnly' => true),
            array('privacy', 'length', 'max' => 9),
            array('lastname, firstname', 'length', 'max' => 50),
            array('email, street', 'length', 'max' => 255),
            array('about', 'safe'),
            array('lastname, firstname, email, about, street', 'default', 'setOnEmpty' => true, 'value' => null),
            array('profile_id, users_id, timestamp, privacy, lastname, firstname, email, about, street', 'safe', 'on' => 'search'),
        );
        
        return $arr;
    }
        public function setProfile($attributes) {

        $this->setAttribute('timestamp', time());
        $this->setAttribute('firstname', $attributes['firstname']);
        $this->setAttribute('lastname', $attributes['lastname']);
        $this->setAttribute('email', $attributes['email']);
        return $this;
    }

    
}